package com.xvaca.spcms.servlet;

import java.util.Timer;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import org.apache.log4j.Logger;

import com.xvaca.spcms.cache.Cache;
import com.xvaca.spcms.dao.PipeDAO;
import com.xvaca.spcms.task.SyncDataTimerTask;

/**
 * Servlet implementation class InitServlet
 */
public class InitServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	
	private static final Logger logger = Logger.getLogger(InitServlet.class);
	
	public void init(ServletConfig config) throws ServletException {
		
		// 初始化渠道
		Cache.pipes = new PipeDAO().getPipeListByStatus();
		logger.info("初始化渠道信息" + Cache.pipes.size() + "个");
		
		Timer timer = new Timer();
		timer.schedule(new SyncDataTimerTask(), 10000, 30000);
		
	}

}
